<?php if (!defined('THINK_PATH')) exit(); /*a:4:{s:77:"E:\web\project\baojia\wwwww\public/../application/admin\view\jishu\hedit.html";i:1539791327;s:70:"E:\web\project\baojia\wwwww\application\admin\view\layout\default.html";i:1529292885;s:67:"E:\web\project\baojia\wwwww\application\admin\view\common\meta.html";i:1535990037;s:69:"E:\web\project\baojia\wwwww\application\admin\view\common\script.html";i:1533222223;}*/ ?>
<!DOCTYPE html>
<html lang="<?php echo $config['language']; ?>">
    <head>
        <meta charset="utf-8">
<title><?php echo (isset($title) && ($title !== '')?$title:''); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">

<link rel="shortcut icon" href="/public/assets/img/favicon.ico" />
<!-- Loading Bootstrap -->
<link href="/public/assets/css/backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.css?v=<?php echo \think\Config::get('site.version'); ?>" rel="stylesheet">
<link href="/public/assets/js/uploadify/uploadify.css" rel="stylesheet">

<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
  <script src="/public/assets/js/html5shiv.js"></script>
  <script src="/public/assets/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
    var require = {
        config:  <?php echo json_encode($config); ?>
    };
</script>
<script src="/public/assets/libs/jquery/dist/jquery.min.js"></script>
<script src="/public/assets/js/uploadify/jquery.uploadify.min.js"></script>
    </head>

    <body class="inside-header inside-aside <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
        <div id="main" role="main">
            <div class="tab-content tab-addtabs">
                <div id="content">
                    <div class="row">
                        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                            <section class="content-header hide">
                                <h1>
                                    <?php echo __('Dashboard'); ?>
                                    <small><?php echo __('Control panel'); ?></small>
                                </h1>
                            </section>
                            <?php if(!IS_DIALOG && !$config['fastadmin']['multiplenav']): ?>
                            <!-- RIBBON -->
                            <div id="ribbon">
                                <ol class="breadcrumb pull-left">
                                    <li><a href="dashboard" class="addtabsit"><i class="fa fa-dashboard"></i> <?php echo __('Dashboard'); ?></a></li>
                                </ol>
                                <ol class="breadcrumb pull-right">
                                    <?php foreach($breadcrumb as $vo): ?>
                                    <li><a href="javascript:;" data-url="<?php echo $vo['url']; ?>"><?php echo $vo['title']; ?></a></li>
                                    <?php endforeach; ?>
                                </ol>
                            </div>
                            <!-- END RIBBON -->
                            <?php endif; ?>
                            <div class="content">
                                <style>
    .table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
        border: 1px solid #989898;
    }
    .table-bordered {
        border: 1px solid #989898;
    }
</style>
<form id="add-form" class="form-horizontal" method="POST" action="<?php echo url('hsave'); ?>">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">应用行业名称:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="text" name="name" value="<?php echo (isset($data['name']) && ($data['name'] !== '')?$data['name']:''); ?>" class="form-control"/>
        </div>
    </div>
     <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">应用行业描述:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea type="text" name="des" id="des" class="form-control"><?php echo (isset($data['des']) && ($data['des'] !== '')?$data['des']:''); ?></textarea>
        </div>
     </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">板块类型:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="fixed-table-body">
                <table id="table" class="table table-striped table-bordered table-hover" width="100%" style="background-color: #fff;">
                    <thead>
                        <tr>
                            <th style="text-align: center; vertical-align: middle; ">
                                <div class="th-inner ">板块</div>
                                <div class="fht-cell"></div>
                            </th>
                            <th style="text-align: center; vertical-align: middle; ">
                                <div class="th-inner ">子板块</div>
                                <div class="fht-cell"></div>
                            </th>
                            <th style="text-align: center; vertical-align: middle; ">
                                <div class="th-inner ">前后台</div>
                                <div class="fht-cell"></div>
                            </th>
                            <th style="text-align: center; vertical-align: middle; ">
                                <div class="th-inner ">页面</div>
                                <div class="fht-cell"></div>
                            </th>
                            <th style="text-align: center; vertical-align: middle; ">
                                <div class="th-inner ">功能</div>
                                <div class="fht-cell"></div>
                            </th>
                        </tr>
                    </thead>
                    <tbody data-listidx="0">
                       <?php if(is_array($plate) || $plate instanceof \think\Collection || $plate instanceof \think\Paginator): $k = 0; $__LIST__ = $plate;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($k % 2 );++$k;if($vo['child']): if(is_array($vo['child']) || $vo['child'] instanceof \think\Collection || $vo['child'] instanceof \think\Paginator): $ck = 0; $__LIST__ = $vo['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$ch): $mod = ($ck % 2 );++$ck;

                                if($ch=="无"){
                                     $home=db('page')->where(['admin_home'=>1,'plate_id'=>$vo['id']])->select();

                                     $admin=db('page')->where(['admin_home'=>2,'plate_id'=>$vo['id']])->select();
                                }else{
                                      $home=db('page')->where(['admin_home'=>1,'plate_id'=>$ch['id']])->select();

                                      $admin=db('page')->where(['admin_home'=>2,'plate_id'=>$ch['id']])->select();
                                }

                                 $home_count=count($home);
                                 $admin_count=count($admin);

                                 $child_count=$home_count+$admin_count;
                               if(is_array($home) || $home instanceof \think\Collection || $home instanceof \think\Paginator): $pk = 0; $__LIST__ = $home;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$page): $mod = ($pk % 2 );++$pk;?>
                              <tr>
                                <?php if($ck == 1 AND $pk == 1): ?>
                                   <td style="text-align: center; vertical-align: middle;" rowspan="<?php echo $vo['page_count']; ?>"><!-- 总行数(页面数) -->
                                      <label style="font-weight: normal;"><input type="checkbox" name="bid[]" value="<?php echo $vo['id']; ?>" <?php if((!empty($data)) AND in_array($vo['id'],$data['bid'])): ?>checked<?php endif; ?>><?php echo $vo['name']; ?></label>
                                   </td>
                                 <?php endif; if($pk == 1): ?>
                                  <td style="text-align: center; vertical-align: middle;"  rowspan="<?php echo $child_count; ?>">
                                      <label style="font-weight: normal;">
                                       <?php if($ch == '无'): ?>
                                          无
                                       <?php else: ?>
                                        <input type="checkbox" name="child_bid[]" class="checkbox_<?php echo $vo['id']; ?>" value="<?php echo $ch['id']; ?>"
                                        <?php if((!empty($data)) AND in_array($ch['id'],$data['child_bid'])): ?>checked<?php endif; ?>><?php echo $ch['name']; endif; ?>
                                    </label>
                                  </td>
                                <?php endif; ?>
                                  <td style="text-align: center; vertical-align: middle;">
                                      前台页面
                                  </td>
                                <td style="text-align: center; vertical-align: middle;">
                                    <label style="font-weight: normal;"><input type="checkbox" name="page_id[]" <?php if($ch != '无'): ?> data-child_plate="<?php echo $ch['id']; ?>" <?php endif; ?> class="checkbox_<?php echo $vo['id']; ?>" value="<?php echo $page['id']; ?>" <?php if((!empty($data)) AND in_array($page['id'],$data['page_id'])): ?>checked<?php endif; ?> ><?php echo $page['name']; ?></label>
                                </td>
                                <td style="text-align: center; vertical-align: middle;">
                                  <?php 
                                      $gongnen=db('plate_gongnen')->where(['page_id'=>$page['id']])->select();
                                     if(is_array($gongnen) || $gongnen instanceof \think\Collection || $gongnen instanceof \think\Paginator): $i = 0; $__LIST__ = $gongnen;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$g): $mod = ($i % 2 );++$i;
                                        $info=db('gongnen')->where('id', $g['gid'])->find();
                                        $data_ch=db('gongnen_child')->where('id', $g['child_id'])->find();
                                      ?>
                                    <label style="font-weight: normal;"><input type="checkbox" name="gong_id[]" <?php if($ch != '无'): ?> data-child_plate="<?php echo $ch['id']; ?>" <?php endif; ?> class="checkbox_<?php echo $vo['id']; ?>" value="<?php echo $g['id']; ?>" <?php if((!empty($data)) AND in_array($g['id'],$data['gong_id'])): ?>checked<?php endif; ?> ><?php echo $info['name']; ?>-<?php echo $data_ch['cname']; ?></label>
                                   <?php endforeach; endif; else: echo "" ;endif; ?> 
                                </td>
                            </tr>
                           <?php endforeach; endif; else: echo "" ;endif; if(is_array($admin) || $admin instanceof \think\Collection || $admin instanceof \think\Paginator): $pk = 0; $__LIST__ = $admin;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$page): $mod = ($pk % 2 );++$pk;?>
                            <tr>
                                <?php if($ch['home'] == '' AND $ck == 1 AND $pk == 1): ?>
                                   <td style="text-align: center; vertical-align: middle;" rowspan="<?php echo $vo['page_count']; ?>"><!-- 总行数(页面数) -->
                                      <label style="font-weight: normal;"><input type="checkbox" name="bid[]" value="<?php echo $vo['id']; ?>" <?php if((!empty($data)) AND in_array($vo['id'],$data['bid'])): ?>checked<?php endif; ?>><?php echo $vo['name']; ?></label>
                                   </td>
                                <?php endif; if($pk == 1): ?>
                                   <td style="text-align: center; vertical-align: middle;"  rowspan="<?php echo $child_count; ?>">
                                      <label style="font-weight: normal;">
                                        <?php if($ch == '无'): ?>
                                          无
                                        <?php else: ?>
                                          <input type="checkbox" name="child_bid[]" class="checkbox_<?php echo $vo['id']; ?>" value="<?php echo $ch['id']; ?>"
                                                 <?php if((!empty($data)) AND in_array($ch['id'],$data['child_bid'])): ?>checked<?php endif; ?>><?php if($pk == 1): ?><?php echo $ch['name']; endif; endif; ?>
                                    </label>
                                  </td>
                                <?php endif; ?>
                                  <td style="text-align: center; vertical-align: middle;">
                                      后端页面
                                  </td>
                                <td style="text-align: center; vertical-align: middle;">
                                    <label style="font-weight: normal;"><input type="checkbox" name="page_id[]" <?php if($ch != '无'): ?> data-child_plate="<?php echo $ch['id']; ?>" <?php endif; ?> class="checkbox_<?php echo $vo['id']; ?>" value="<?php echo $page['id']; ?>" <?php if((!empty($data)) AND in_array($page['id'],$data['page_id'])): ?>checked<?php endif; ?>><?php echo $page['name']; ?></label>
                                </td>
                                <td style="text-align: center; vertical-align: middle;">
                                  <?php 
                                      $gongnen=db('plate_gongnen')->where(['page_id'=>$page['id']])->select();
                                     if(is_array($gongnen) || $gongnen instanceof \think\Collection || $gongnen instanceof \think\Paginator): $i = 0; $__LIST__ = $gongnen;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$g): $mod = ($i % 2 );++$i;
                                        $info=db('gongnen')->where('id', $g['gid'])->find();
                                        $data_ch=db('gongnen_child')->where('id', $g['child_id'])->find();
                                      ?>
                                    <label style="font-weight: normal;"><input type="checkbox" class="checkbox_<?php echo $vo['id']; ?>" name="gong_id[]" <?php if($ch != '无'): ?> data-child_plate="<?php echo $ch['id']; ?>" <?php endif; ?> value="<?php echo $g['id']; ?>" <?php if((!empty($data)) AND in_array($g['id'],$data['gong_id'])): ?>checked<?php endif; ?> ><?php echo $info['name']; ?>-<?php echo $data_ch['cname']; ?></label>
                                   <?php endforeach; endif; else: echo "" ;endif; ?> 
                                </td>
                            </tr>
                          <?php endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?>
                        <!-- 一列 -->
                        <?php else: 

                             $home=db('page')->where(['admin_home'=>1,'plate_id'=>$vo['id']])->select();

                             $admin=db('page')->where(['admin_home'=>2,'plate_id'=>$vo['id']])->select();

                             $home_count=count($home);
                             $admin_count=count($admin);


                           if(is_array($home) || $home instanceof \think\Collection || $home instanceof \think\Paginator): $pk = 0; $__LIST__ = $home;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$page): $mod = ($pk % 2 );++$pk;?>
                        <tr>
                           <?php if($pk == 1): ?>
                            <td style="text-align: center; vertical-align: middle;" rowspan="<?php echo $vo['page_count']; ?>"><!-- 总行数(页面数) -->
                               <label style="font-weight: normal;"><input type="checkbox" name="bid[]" value="<?php echo $vo['id']; ?>" <?php if((!empty($data)) AND in_array($vo['id'],$data['bid'])): ?>checked<?php endif; ?>><?php echo $vo['name']; ?></label>
                            </td>
                            <td style="text-align: center; vertical-align: middle;" rowspan="<?php echo $home_count; ?>">
                                <label style="font-weight: normal;">
                                    无
                                </label>
                            </td>
                           <?php endif; ?>
                           <td style="text-align: center; vertical-align: middle;">
                               前台页面
                           </td>
                           <td style="text-align: center; vertical-align: middle;">
                               <label style="font-weight: normal;"><input type="checkbox" name="page_id[]" data-child_plate="" class="checkbox_<?php echo $vo['id']; ?>" value="<?php echo $page['id']; ?>" <?php if((!empty($data)) AND in_array($page['id'],$data['page_id'])): ?>checked<?php endif; ?> ><?php echo $page['name']; ?></label>
                           </td>
                           <td style="text-align: center; vertical-align: middle;">
                               <?php 
                               $gongnen=db('plate_gongnen')->where(['page_id'=>$page['id']])->select();
                                if(is_array($gongnen) || $gongnen instanceof \think\Collection || $gongnen instanceof \think\Paginator): $i = 0; $__LIST__ = $gongnen;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$g): $mod = ($i % 2 );++$i;
                               $info=db('gongnen')->where('id', $g['gid'])->find();
                               $data_ch=db('gongnen_child')->where('id', $g['child_id'])->find();
                                ?>
                               <label style="font-weight: normal;"><input type="checkbox" name="gong_id[]" data-child_plate="" class="checkbox_<?php echo $vo['id']; ?>" value="<?php echo $g['id']; ?>" <?php if((!empty($data)) AND in_array($g['id'],$data['gong_id'])): ?>checked<?php endif; ?> ><?php echo $info['name']; ?>-<?php echo $data_ch['cname']; ?></label>
                               <?php endforeach; endif; else: echo "" ;endif; ?>
                           </td>
                       </tr>
                       <?php endforeach; endif; else: echo "" ;endif; if(is_array($admin) || $admin instanceof \think\Collection || $admin instanceof \think\Paginator): $pk = 0; $__LIST__ = $admin;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$page): $mod = ($pk % 2 );++$pk;?>
                       <tr>
                          <?php if($home == '' AND $pk == 1): ?>
                           <td style="text-align: center; vertical-align: middle;" rowspan="<?php echo $vo['page_count']; ?>"><!-- 总行数(页面数) -->
                               <label style="font-weight: normal;"><input type="checkbox" name="bid[]" value="<?php echo $vo['id']; ?>" <?php if((!empty($data)) AND in_array($vo['id'],$data['bid'])): ?>checked<?php endif; ?>><?php echo $vo['name']; ?></label>
                           </td>
                          <?php endif; if($pk == 1): ?>
                           <td style="text-align: center; vertical-align: middle;" rowspan="<?php echo $admin_count; ?>">
                               <label style="font-weight: normal;">
                                   无
                               </label>
                           </td>
                          <?php endif; ?>
                           <td style="text-align: center; vertical-align: middle;">
                               前台页面
                           </td>
                           <td style="text-align: center; vertical-align: middle;">
                               <label style="font-weight: normal;"><input type="checkbox" name="page_id[]" data-child_plate="" class="checkbox_<?php echo $vo['id']; ?>" value="<?php echo $page['id']; ?>" <?php if((!empty($data)) AND in_array($page['id'],$data['page_id'])): ?>checked<?php endif; ?> ><?php echo $page['name']; ?></label>
                           </td>
                           <td style="text-align: center; vertical-align: middle;">
                               <?php 
                               $gongnen=db('plate_gongnen')->where(['page_id'=>$page['id']])->select();
                                if(is_array($gongnen) || $gongnen instanceof \think\Collection || $gongnen instanceof \think\Paginator): $i = 0; $__LIST__ = $gongnen;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$g): $mod = ($i % 2 );++$i;
                                  $info=db('gongnen')->where('id', $g['gid'])->find();
                                  $data_ch=db('gongnen_child')->where('id', $g['child_id'])->find();
                                  ?>
                               <label style="font-weight: normal;"><input type="checkbox" name="gong_id[]" data-child_plate="" class="checkbox_<?php echo $vo['id']; ?>" value="<?php echo $g['id']; ?>" <?php if((!empty($data)) AND in_array($g['id'],$data['gong_id'])): ?>checked<?php endif; ?> ><?php echo $info['name']; ?>-<?php echo $data_ch['cname']; ?></label>
                               <?php endforeach; endif; else: echo "" ;endif; ?>
                           </td>
                       </tr>
                       <?php endforeach; endif; else: echo "" ;endif; endif; endforeach; endif; else: echo "" ;endif; ?>


              
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">应用逻辑:</label>
        <div class="col-xs-12 col-sm-8">
            <table class="table table-striped table-bordered table-hover">
              <tr> <th>类目</th> <th>工时</th> <th>说明</th></tr>

             <?php if(is_array($logic) || $logic instanceof \think\Collection || $logic instanceof \think\Paginator): $i = 0; $__LIST__ = $logic;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>  
              <tr> <td><input type="radio" name="logic_id" <?php if((!empty($data)) AND $data['logic_id'] == $vo['id']): ?>checked<?php endif; ?> value="<?php echo $vo['id']; ?>"><?php echo $vo['name']; ?></td> <td><?php echo $vo['cycle']; ?></td> <td><?php echo $vo['des']; ?></td></tr>
             <?php endforeach; endif; else: echo "" ;endif; ?>  
          </table>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" name="id" value="<?php echo (isset($data['id']) && ($data['id'] !== '')?$data['id']:''); ?>" class="form-control"/>
            <button type="submit" class="btn btn-success btn-embossed"><?php echo __('OK'); ?></button>
        </div>
    </div>
</form>


<script>
    $(function(){
       $("input[name='bid[]']").click(function(){
           var id=$(this).val();

           var checked=$(this).prop("checked");
           $(".checkbox_"+id).each(function(){
              $(this).prop("checked",checked);
          });
        
       });

        $("input[name='page_id[]']").click(function(){
           
           var gongnen_check=$(this).parents("td").next('td').find("input[name='gong_id[]']");
        
           var checked=$(this).prop("checked");
           gongnen_check.each(function(){
              $(this).prop("checked",checked);
          });
        
       });

      $("input[name='child_bid[]']").click(function(){
           
           var child_id=$(this).val();
           var checked=$(this).prop("checked");

           $("input[data-child_plate="+child_id+"]").each(function(){
              $(this).prop("checked",checked);
           });
           
        
       });

    })
</script>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
<script src="/public/assets/js/require<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js" data-main="/public/assets/js/require-backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js?v=<?php echo $site['version']; ?>"></script>
    </body>
</html>